package com.xplan.actions;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 基类Action，提供request，session，response等对象供子类使用，
 * 其他公用方法可以自行加入
 * @author will
 *
 */
public class BaseAction extends ActionSupport implements SessionAware,
		ServletRequestAware, ServletResponseAware {

	protected ActionContext context = ActionContext.getContext();
	protected HttpServletRequest request;
	protected HttpServletResponse response;
	protected SessionMap session;
	protected boolean debug=true;
	protected String forwordaction;

	public void setSession(Map map) {
		this.session = (SessionMap) map;
	}

	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	public void setServletResponse(HttpServletResponse response) {
		try{
			response.setCharacterEncoding("utf-8");
			this.response = response;
		}catch(Exception ex)
		{
			ex.printStackTrace();
		}
		
	}

	public String getForwordaction() {
		return forwordaction;
	}

	public void setForwordaction(String forwordaction) {
		this.forwordaction = forwordaction;
	}
	
 
}
